def is_number(s):
    try:
        int(s,16)
        return True
    except ValueError:
        return False

zmm0_count_gt0 = 0
zmm0_gt0 = []
zmm1_count_gt0 = 0
zmm1_gt0 = []
zmm0_count_0 = 0
zmm1_count_0 = 0
zmm0_count_1 = 0
zmm1_count_1 = 0
line_count = 0

with open('./your_file.log', 'r') as file:
    for line in file:
        line_count += 1
        parts = line.strip().split(', ')
        if len(parts)==2 and parts[0].startswith('[0]wait zmm = ') and parts[1].startswith('zmm_count = 0x'):
            print(parts)
            print('len_number:',len(parts[0]),len(parts[1]))
            if len(parts[0]) == 15 and len(parts[1]) == 22:
                zmm = int(parts[0].split('= ')[1])
                zmm_count = parts[1].split('= 0x')[1]
                print(is_number(zmm_count))
                if is_number(zmm_count):
                    zmm_count = int(zmm_count,16)
                    if zmm == 0 and zmm_count > 0:
                        zmm0_count_gt0 += 1
                        zmm0_gt0.append(line_count)
                    elif zmm == 1 and zmm_count > 0:
                        zmm1_count_gt0 += 1
                        zmm1_gt0.append(line_count)
                    if zmm_count == 0:
                        if zmm == 0:
                            zmm0_count_0 += 1
                        elif zmm == 1:
                            zmm1_count_0 += 1
                    if zmm_count == 1:
                        if zmm == 0:
                            zmm0_count_1 += 1
                        elif zmm == 1:
                            zmm1_count_1 += 1

print(f"zmm=0时zmm_count大于0的次数: {zmm0_count_gt0}")
print("位置:",zmm0_gt0)
print(f"zmm=1时zmm_count大于0的次数: {zmm1_count_gt0}")
print("位置:",zmm1_gt0)
print(f"zmm_count=0时zmm=0的数量: {zmm0_count_0}")
print(f"zmm_count=0时zmm=1的数量: {zmm1_count_0}")
print(f"zmm_count=1时zmm=0的数量: {zmm0_count_1}")
print(f"zmm_count=1时zmm=1的数量: {zmm1_count_1}")
